package gui;

import javax.swing.JLabel;

/**
 * @author Ramy Refky 
 * */
public class TextComponentLabel extends ComponentLabel{

	private static final long serialVersionUID = 1L;
	
	JLabel textLabel;
	
	/**
	 * Constructor initializes ComponentLabel.
	 * @param XLocation, YLocation, Width, Height
	 */
	public TextComponentLabel(int xLoc,int yLoc,int originalWidth, int originalHeight){
		super(xLoc,yLoc,originalWidth,originalHeight);
		
		textLabel = new JLabel("",JLabel.CENTER);
		textLabel.setBounds(0,newHeight/3,newWidth,15);
		add(textLabel);
		
		repaint();
	}
	@Override
	public void zoomAdjust(Double zoomFactor){
		newWidth=(int) (originalWidth*zoomFactor);
		newHeight=(int) (originalHeight*zoomFactor);
		setBounds(0,0,newWidth,newHeight);
		textLabel.setBounds(0,newHeight/3,newWidth,15);
		repaint();
	}
	/**
	 * Sets the title of the TEXT Component a given String text.
	 */
	public void setComponentText(String text){
		textLabel.setText(text);
		repaint();
	}
	/**
	 * Gets the title of the TEXT Component's label.
	 * @return String
	 */
	public String getComponentText(){
		return textLabel.getText();
	}
}
